<docs>
  ## 我的关注
</docs>
<template>
  <!-- 内边距container 开始 -->
  <div class="container">
    <my-bread title="我的关注"></my-bread>
      <pagination-list
        @pullingDown="asyncFetch"
        :no-data="noData"
        class="search-result"
        :ajax-loading="ajaxLoading"
      >
        <div class="_item"
        @click="routerLink(item)"
        v-for="(item, index) in zpxx" :key="index">
          <div class="newjob_item_row clearfix">
            <span class="newjob_left company overflow">{{item.dwmc}}</span>
            <!-- <span class="newjob_left data overflow">{{item.dwlx_xs}}</span> -->
          </div>
          <div class="newjob_item_row last_row clearfix">
            <span class="job_name overflow">
              <span>联系人：{{item.dwjbr}}</span>
            </span>
            <span class="job_money overflow" v-if="item.lxrdh">
              <span>联系电话：{{item.lxrdh}}</span>
            </span>
          </div>
        </div>
      </pagination-list>
  </div>
</template>
<script>
import $ from "@/common/js/axios";
import { validator } from "common/js/valid";
import PaginationList from "base/paginationList/paginationList";

export default {
  name: "search",
  components: {  PaginationList },
  data() {
    return {
      ajaxLoading: false,
      noData: false,
      zpxx: [],
      form: {
        pageNum: 1,
        pageSize: "10"
      }
    };
  },
  methods: {
    // 搜索职位
    GET_search(page = 1) {
      this.$loading = true;
      this.ajaxLoading = true;
      this.form.pageNum = page;
      $.get("/grgl/wdgzCx",{params:this.form})
        .then(res => {
          const data = res.returnData;
          // 无查询结果
          if (+data.executeResult === 0) {
            this.noData = true;
            if (page === 1) {
              this.zpxx = [];
            }
          } else {
            this.noData = false;
            // 有数据
            if (page === 1) {
              this.zpxx = data.gzxx;
            } else {
              this.zpxx = this.zpxx.concat(data.gzxx);
            }
            if (data.gzxx.length<10) {
              this.noData = true;
            }
          }
        })
        .finally(() => {
          this.ajaxLoading = false;
          this.$loading = false;
        });
    },
    // async fetach data
    asyncFetch(page) {
      this.GET_search(page);
    },
    routerLink(val){
      this.$loading = true;
      $.post("/grgl/zpdwgzBc", {sfgz:'1',dwdjid:val.dwdjid,zpgws:val.zpgws,bj:'1'})
        .then(res => {
          const data = res.returnData;
          if (+data.executeResult === 1) {
            this.$router.push({path:'/company/newcompanyDetail',query:{id: val.dwdjid}})
          }
        })
        .finally(() => {
          this.$loading = false;
        });
    }
  },
  created() {
    // this.form.qwgjz = this.$store.getters.qwgjz;
    this.GET_search();
  }
};
</script>
<style scoped lang="scss">
@import "~common/scss/var.scss";
._item {
  // height: $height-input * 2;
  display: block;
  margin: $height-base/10 0;
  border-radius: $radius-base3;
  background-color: #fff;
  padding: $font-size-base 0 $margin-base 0;
  position: relative;
  .newjob_item_row {
    padding: 0 $padding-btn;
    margin-bottom: $margin-base;
    .job_name {
      color: $color-text-title;
      font-weight: 400;
      width: 40%;
      height: 40px;
      line-height: 40px;
      float: left;
      .bgPic {
        // display: inline-block;
        // vertical-align: middle;
        background: url("~common/images/want.png") top right no-repeat;
        background-size: $font-size-large;
        padding-right: $font-size-larges;
      }
      // i {
      //   display: inline-block;
      //   width: $font-size-large;
      //   height: $font-size-large;
      //   vertical-align: middle;
      //   background: url("~common/images/want.png") top right no-repeat;
      //   background-size: $font-size-large;
      // }
    }
    .job_money {
      float: right;
      color: #817e81;
      font-size: $font-size-small;
      width: 60%;
      text-align: right;
      height: 40px;
      line-height: 40px;
      word-wrap: break-word;
    }
    .newjob_left,.data {
      float: left;
      font-size: $font-size-small;
      color: $color-text-title;
      height: $height-width_line * 2;
      line-height: $height-width_line * 2;
    }
    .data{
      float: right;
    }
    .newjob_right {
      float: right;
      background-color: #ff9900;
      padding: $radius-base;
      width: $radius-base4 * 4;
      box-sizing: border-box;
      color: #fff;
      font-size: $padding-base-half * 3;
      border-radius: $padding-base-half;
      a {
        color: #fff;
      }
      .deliver {
        width: $font-size-small;
        height: $font-size-small;
        vertical-align: top;
      }
    }
    .not_allowed{
      background-color: #ccc;
    }
    .phone {
      background-color: #3399ff;
    }
    .company {
      background: url("~common/images/company.png") 0 $padding-base-half
        no-repeat;
      background-size: $height-input_base;
      padding-left: $padding-base-half * 4;
      width: 66%;
    }
    .term {
      font-size: $font-size-small;
      .item {
        box-sizing: border-box;
      }

      .item:after {
        content: "|";
        margin-left: $padding-base-half;
        color: $color-text-placeholder;
      }

      .item:last-child:after {
        content: "";
      }
    }
    .address {
      padding: $padding-btn 0;
      color: $color-text-title;
    }
  }
  .last_row {
    margin-bottom: 0;
  }
  .sended {
    position: absolute;
    top: 0;
    left: 0;
    font-size: $padding-base;
    width: $font-size-ultra-plus;
    height: $font-size-small;
    line-height: $font-size-small;
    text-align: center;
    background-color: #ccc;
    color: #fff;
  }
}
._item:first-child {
  border-radius: 0 0 $radius-base3 $radius-base3;
  margin-top: 0;
}
</style>
